<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %> 
<script type="text/javascript">
function sys_showaccount(act_id)
{    
    var url = "rs/account/show.do";
    var content = "account.id=" + act_id;
    var objectid = "sys_account";
    sendXMLHttpRequest(url, content, objectid); 
}

function account_password_change(account_id)
{
    var url = "rs/password/change.do";
    var content = "account.id=" + account_id;
    var objectid = "content";
    sendXMLHttpRequest(url, content, objectid);     
}
</script>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="5"></td>
      </tr>
      <tr>
        <td height="25" class="t1">
          <img src="images/small0.gif" width="14" height="12"> 您现在的位置&gt;&gt;账号管理</td>
      </tr>
    </table>
    <div id="sys_account">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td >
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td height="25" class="table_blue">
          <strong><img src="images/dot.jpg" width="13" height="9">账号列表</strong>
          <span style="float:right;color:#000000;">        
          <button id="btn1" dojoType="dijit.form.Button" 
            onclick="sys_showaccount('');">新增</button>
          &nbsp;&nbsp;
          </span>
          </td>
      </tr>   
      <tr>
      <td >
      <table id="page_table" width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" class="table_g1" width="10%">序号</td>
        <td align="center" class="table_g2" width="15%">账号</td>
        <td align="center" class="table_g2" width="20%">名称</td>
        <td align="center" class="table_g2" width="10%">类型</td>
        <td align="center" class="table_g2" width="10%">角色</td>
        <td align="center" class="table_g2" width="20%">添加日期</td>
        <td align="center" class="table_g2" width="15%"></td>
      </tr>
      <tbody id="page_body">
      <s:if test="accounts.size()>0" >
        <s:iterator value="accounts" status="stat" >
        <tr onmouseover="this.style.background='#c0c0c0';" 
            onmouseout="this.style.background='#ffffff';"> 
          <td class="table_w1" align="center"><s:property value="#stat.index+1" /></td>
          <td class="table_w1" align="center"><s:property value="id" /></td>
          <td class="table_w2" align="center"><s:property value="name" /></td>    
          <td class="table_w2" align="center"><s:if test='%{type=="0"}'>系统管理员</s:if><s:elseif test='%{type=="1"}'>普通账户</s:elseif><s:else>渠道账户</s:else></td>         
          <td class="table_w2" align="center"><s:if test="roles.size()>0" >
            <s:iterator value="roles" status="stat1">
            <s:if test="id.equals(accounts.get(#stat.index).roleId)" ><s:property value="name" /></s:if>
            </s:iterator> 
            </s:if></td>
          <td class="table_w2" align="center"><s:property value='%{formatDate(updateTime,"yyyy-MM-dd HH:mm:ss")}' /></td>
          <td class="table_w2" align="center">
            <a href="javascript:void(0);" 
              onclick="sys_showaccount('<s:property value="id" />');">设置</a>
              &nbsp;&nbsp;
            <a href="javascript:void(0);" 
              onclick="account_password_change('<s:property value="id" />');">修改密码</a>
        </tr>    
        </s:iterator>
      </s:if>
      </tbody>
      </table>
      </td>
      </tr>
      <tr>
        <td class="table_g1" align="center" height="25">
         <span style="float:center;color:#000000;">      
            &nbsp;<button id="btnPage0" dojoType="dijit.form.Button" onclick="javascript:document.getElementById('page_index').value='1/1';page.singlePage();">单页</button>
            &nbsp;<button id="btnPage1" dojoType="dijit.form.Button" onclick="page.firstPage();">首页</button>
            &nbsp;<button id="btnPage2" dojoType="dijit.form.Button" onclick="page.prePage();">上一页</button>
            &nbsp;<input id="page_index" value="" onkeydown="javascript:if(event.keyCode==13){page.aimPage(this.value-1);}" />
            &nbsp;<button id="btnPage3" dojoType="dijit.form.Button" onclick="page.nextPage();">下一页</button>
            &nbsp;<button id="btnPage4" dojoType="dijit.form.Button" onclick="page.lastPage();">末页</button>&nbsp;
          </span>          
        </td>
      </tr>  
      <tr> 
        <td background="images/table_bom_bg.jpg">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <img src="images/table_bom_left.jpg" width="20" height="15"></td>
            <td></td>
            <td align="right">
              <img src="images/table_bom_right.jpg" width="20" height="15"></td>
          </tr>
          </table>
        </td>
      </tr>
    </table>  
    </div>
  </td>
  <td width="5"></td>
  </tr>
  </table>